<!DOCTYPE html>
<html lang="en">
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<head>
    <meta charset="utf-8" />
    <title>GremlinClientService</title>
    <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css" />
</head>

<body>
<!-- Processor Documentation ================================================== -->
<h2>Description:</h2>
<p>
    This client service configures a connection to a Gremlin Server and allows Gremlin queries to be executed against
    the Gremlin Server. For more information on Gremlin and Gremlin Server, see the <a href="http://tinkerpop.apache.org/">Apache Tinkerpop</a> project.
</p>
<h2>Warning for New Users</h2>
<p>
    A common issue when creating Gremlin scripts for first time users is to accidentally return an unserializable object. Gremlin
    is a Groovy DSL and so it behaves like compiled Groovy including returning the last statement in the script. This is an example
    of a Gremlin script that could cause unexpected failures:
</p>
<pre>
    g.V().hasLabel("person").has("name", "John Smith").valueMap()
</pre>
<p>
    The <em>valueMap()</em> step is not directly serializable and will fail. To fix that you have two potential options:
</p>
<pre>
    //Return a Map
    g.V().hasLabel("person").has("name", "John Smith").valueMap().next()
</pre>
<p>
    Alternative:
</p>
<pre>
    g.V().hasLabel("person").has("name", "John Smith").valueMap()
    true //Return boolean literal
</pre>
</body>
</html>